﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Master/HomeSubMaster.Master" AutoEventWireup="true" 
    ValidateRequest="false" CodeBehind="Add.aspx.cs" Inherits="CSP.Web.MyHome.ServiceInfo.Add" %>

<asp:Content ID="CSPHead" ContentPlaceHolderID="CSPHead" runat="server">
    <meta charset="utf-8">
    <title>服务发布-服务信息</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
</asp:Content>
<asp:Content ID="CSPStyleAndScript" ContentPlaceHolderID="CSPStyleAndScript" runat="server">
    <script type="text/javascript" src="/Scripts/Validate/validate.js"></script>
    <script src="/Scripts/UI/Expand/dialog.js" type="text/javascript"></script>
    <script type="text/javascript">
		$().ready(function () {
			$("#MyHome").validate();

			$(window).bind('beforeunload', function () {

				return '您输入的内容尚未保存，确定离开此页面吗？';
			});
		});
		function Btn_Submit() {
			//解除绑定
			$(window).unbind('beforeunload');
			var editorValue=<%=U_CSPEditor.ClientID %>.GetValue();
			var totalValue=<%=U_ImageUpload.ClientID %>.totalValue();
			var radios=$("#D_Address").find("input[type=radio]");
			if(radios.length==0){
				DialogMessage.Show(2,"亲...您当前还未设置服务区域,请设置一个服务区域,可以被迅速的根据地址找到你~",function(){
					AddAddress();
				});
				return false;
			}
			var radioChecked=false;
			$.each(radios,function(index,data){
				if(data.checked==true)
				{
					radioChecked=true;
					return;
				}
			});

			if(radioChecked==false){
				DialogMessage.Show(2,"亲...请设置一个服务区域,可以被迅速的根据地址找到你~~");
				return false;
			}

			if(totalValue=="")
			{
				DialogMessage.Show(2,"亲...课程图片至少上传一个,可以醒目的展示您的课程服务形象~");
				return false;
			}
			else if(editorValue=="")
			{
				DialogMessage.Show(2,"亲...发布内容不能为空哦,可以详细的介绍您的课程服务内容~");
				return false;
			}
			return true;
		}
		//添加地址
		function AddAddress(){
			//解除绑定
			$(window).unbind('beforeunload');
			window.location.href="/MyHome/Address/Add.aspx?urlback=<%=CurrentURL %>";
		}

        function PriceTypeChange(){
            var priceType=$("#<%=S_PriceType.ClientID %>");
               if(priceType.val()=="0"){
                $("#Tr_FixedPrice").show();
                $("#Tr_PriceRange").hide();
                $("#Tr_FixedPrice").find("input[type='text']").val("");
                $("#Tr_PriceRange").find("input[type='text']").val("0");
            }
            else if(priceType.val()=="1"){
                $("#Tr_FixedPrice").hide();
                $("#Tr_PriceRange").show();
                $("#Tr_FixedPrice").find("input[type='text']").val("0");
                $("#Tr_PriceRange").find("input[type='text']").val("");
            }
        
        }

    </script>
</asp:Content>
<asp:Content ID="CSPCrumbs" ContentPlaceHolderID="CSPCrumbs" runat="server">
    <div class="crumbs">
        <span>您当前所在的位置：</span> <a href="/">首页</a> &gt; <a href="/MyHome/ServiceOrder/List.aspx">
            我是服务者</a> &gt; <a href="/MyHome/ServiceInfo/List.aspx">服务发布</a>&gt; <span>信息发布管理</span>
    </div>
    <!--crumbs-->
</asp:Content>
<asp:Content ID="CSPMain" ContentPlaceHolderID="CSPMain" runat="server">
    <div class="box-bd grid-m0 post-message">
        <!-- {{{ flowsteps -->
        <div class="flowsteps">
            <ol class="num3">
                <li class="done"><span class="first">1.服务类型:<label id="L_ServiceType" runat="server"></label></span></li>
                <li class="current"><span>2. 填写服务信息</span></li>
                <li class="next"><span class="last">3. 发布成功</span></li>
            </ol>
        </div>
        <div class="post-cont mh500">
            <table width="90%" border="0" style="border: 1px solid #FF8B19; background: #fffef0;
                margin-bottom: 10px;" class="table-pubinfo current">
                <tbody>
                    <tr>
                        <td height="36" align="right">
                            <span class="fc-red">*</span> 课程标题：
                        </td>
                        <td colspan="6">
                            <input name="textfield" type="text" runat="server" class="{required:true,maxlength:25} input300"
                                id="Txt_Title" size="53">
                            标题应在25个字之内
                        </td>
                    </tr>
                    <tr>
                        <td height="36" align="right">
                            <span class="fc-red">*</span> 适用年龄：
                        </td>
                        <td width="32%">
                            <select name="select" class="{required:true} input50 selectsty" runat="server" id="AgeStart">
                                <option value="1">1</option>
                                <option value="2">2</option>
                                <option value="3">3</option>
                                <option value="4">4</option>
                                <option value="5">5</option>
                                <option value="6">6</option>
                                <option value="7">7</option>
                                <option value="8">8</option>
                                <option value="9">9</option>
                                <option value="10">10</option>
                                <option value="11">11</option>
                                <option value="12">12</option>
                                <option value="13">13</option>
                                <option value="14">14</option>
                                <option value="15">15</option>
                                <option value="16">16</option>
                                <option value="17">17</option>
                                <option value="18">18</option>
                            </select>-
                            <select name="select" class="{required:true} input50 selectsty" runat="server" id="AgeEnd">
                                <option value="1">1</option>
                                <option value="2">2</option>
                                <option value="3">3</option>
                                <option value="4">4</option>
                                <option value="5">5</option>
                                <option value="6">6</option>
                                <option value="7">7</option>
                                <option value="8">8</option>
                                <option value="9">9</option>
                                <option value="10">10</option>
                                <option value="11">11</option>
                                <option value="12">12</option>
                                <option value="13">13</option>
                                <option value="14">14</option>
                                <option value="15">15</option>
                                <option value="16">16</option>
                                <option value="17">17</option>
                                <option value="18">18</option>
                            </select>
                            岁
                        </td>
                        <td width="10%" align="right">
                            <span class="fc-red">*</span> 开班人数：
                        </td>
                        <td colspan="4">
                            <input name="Txt_ClassOfMemberNumber" type="text" runat="server" class="{required:true,number:true} input100"
                                id="Txt_ClassOfMemberNumber" value="0" size="5">
                            <i title="班级最低人数" class="icon icon-tip"></i>
                        </td>
                    </tr>
                    <tr>
                        <td height="36" align="right">
                            <span class="fc-red">*</span> 课程接纳数量 ：
                        </td>
                        <td width="32%">
                            <input name="Txt_EnjoyCount" type="text" runat="server" class="{required:true,number:true} input100"
                                id="Txt_EnjoyCount" size="5">
                            <i title="班级最高人数或课程容纳空间" class="icon icon-tip"></i>
                        </td>
                        <td height="36" align="right">
                            <span class="fc-red">*</span> 开课方式：
                        </td>
                        <td colspan="5">
                            <select name="S_ClassType" runat="server" class="{required:true} input100 selectsty"
                                id="S_ClassType">
                            </select>
                            <i title="滚动预约：报名人数达到机构的规定人数就可开课&#13;随到随学：不受任何限制，预约即可开始上课&#13;计划开班：按照培训机构规定计划开班"
                                class="icon icon-tip"></i>
                        </td>
                    </tr>
                    <tr>
                        <td height="36" align="right">
                            <span class="fc-red">*</span> 价格类型：
                        </td>
                        <td>
                            <select name="S_OriginalPriceUnit" class="{required:true} input100 selectsty" runat="server"
                                id="S_PriceType" onchange="PriceTypeChange()">
                                <option value="0">一口价</option>
                                <option value="1">价格区间</option>
                            </select>
                        </td>
                        <td align="right">
                            <span class="fc-red">*</span>报价单位：
                        </td>
                        <td colspan="4">
                            每
                            <select name="S_PriceUnit" id="S_PriceUnit" runat="server" class="input100 selectsty">
                                <option>次</option>
                                <option>人</option>
                                <option>课</option>
                                <option>分钟</option>
                                <option>小时</option>
                                <option>天</option>
                                <option>月</option>
                                <option>季度</option>
                                <option>年</option>
                            </select>
                        </td>
                    </tr>
                    <tr id="Tr_PriceRange" style="display: none">
                        <td height="36" align="right">
                            <span class="fc-red">*</span> 价格范围：
                        </td>
                        <td>
                            <input name="Txt_PriceStart" class="{required:true,number:true} input50" runat="server"
                                type="text" id="Txt_PriceStart" value="0" size="5">
                            元---<input name="Txt_PriceEnd" class="{required:true,number:true} input50" runat="server"
                                type="text" id="Txt_PriceEnd" value="0" size="5">元<i title="因材施教针对不同的采用不同的教育方针因此价格也不同,前者为最低价格，后者为最高价格"
                                    class="icon icon-tip"></i>
                        </td>
                        <td colspan="5">
                        </td>
                    </tr>
                    <tr id="Tr_FixedPrice">
                        <td height="36" align="right">
                            <span class="fc-red">*</span> 原 价：
                        </td>
                        <td>
                            <input name="Txt_OriginalPrice" class="{required:true,number:true} input50" runat="server"
                                type="text" id="Txt_OriginalPrice" value="0" size="5">
                            元 <i title="如果原价将于现价对比计算出折扣，如果原件小于现价则可默认为0" class="icon icon-tip"></i>
                            <select name="S_OriginalPriceUnit" style="display: none" class="{required:true} input100 selectsty"
                                runat="server" id="S_OriginalPriceUnit">
                                <option>次</option>
                                <option>人</option>
                                <option>课</option>
                                <option>分钟</option>
                                <option>小时</option>
                                <option>天</option>
                                <option>月</option>
                                <option>季度</option>
                                <option>年</option>
                            </select>
                        </td>
                        <td align="right">
                            <span class="fc-red">*</span> 现 价：
                        </td>
                        <td colspan="4">
                            <input name="Txt_Price" type="text" value="0" runat="server" id="Txt_Price" class="{required:true} input50"
                                size="5">
                            元
                        </td>
                    </tr>
                    <tr>
                        <td align="right">
                            <span class="fc-red">*</span> 课程有效期：
                        </td>
                        <td colspan="5">
                            <CSP_U:CSPDatePicker ID="Txt_ClassValidityStart" Style="" Class="{date:true} input100"
                                runat="server" />
                            至
                            <CSP_U:CSPDatePicker ID="Txt_ClassValidityEnd" Class="{date:true,gtdate:'#[Txt_ClassValidityStart]'} input100"
                                runat="server" />
                        </td>
                        <td colspan="5" align="right">
                        </td>
                    </tr>
                    <tr>
                        <td height="36" align="right">
                            <span class="fc-red">*</span> 关 键 字：
                        </td>
                        <td colspan="6">
                            <input name="Txt_KeyWords" type="text" class="{required:true} input300" id="Txt_KeyWords"
                                runat="server" size="40">
                            最多三个关键字，用英文逗号隔开
                        </td>
                    </tr>
                </tbody>
            </table>
            <table width="90%" border="0" style="margin-bottom: 10px;" class="table-pubinfo">
                <tbody>
                    <tr>
                        <td height="50" align="right" valign="middle">
                            课程图片：
                        </td>
                        <td colspan="7">
                            <CSP_U:CSPUpload ID="U_ImageUpload" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td height="50" rowspan="4" align="right" valign="middle" bgcolor="#FFFFFF">
                            <span class="fc-red">*</span> 服务区域：
                        </td>
                        <td height="30" colspan="7" valign="middle" bgcolor="#FFFFFF">
                        </td>
                    </tr>
                    <tr>
                        <td height="30" colspan="7" bgcolor="#FFFFFF">
                            <div id="D_Address">
                                <asp:RadioButtonList RepeatLayout="Flow" ID="R_Address" runat="server">
                                </asp:RadioButtonList>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td height="30" align="right" valign="middle" bgcolor="#FFFFFF">
                            &nbsp;
                        </td>
                        <td colspan="7" valign="top" bgcolor="#FFFFFF">
                            <a class="fc-blue" onclick="AddAddress()" style="cursor: pointer">+新增服务区域</a>
                        </td>
                    </tr>
                </tbody>
            </table>
            <table width="90%" border="0" style="margin-bottom: 10px;" class="table-pubinfo">
                <tbody>
                    <tr>
                        <td height="50" align="middle">
                            描述：
                        </td>
                        <td colspan="7">
                            <textarea name="Txt_Description" class="input500  {maxlength:100}" runat="server" id="Txt_Description" 
                                cols="80" rows="1"></textarea>
                        </td>
                    </tr>
                    <tr>
                        <td height="50" align="right" valign="middle">
                            <span class="fc-red">*</span> 发布内容：
                        </td>
                        <td colspan="7">
                            <CSP_U:CSPEditer runat="server" ID="U_CSPEditor" />
                        </td>
                    </tr>
                    <tr>
                        <td height="50" align="right">
                            &nbsp;
                        </td>
                        <td colspan="7">
                            <asp:RadioButtonList ID="R_Status" CssClass="" runat="server" RepeatLayout="Flow"
                                RepeatDirection="Horizontal">
                                <asp:ListItem Text="发布上线" Value="2" Selected="True"></asp:ListItem>
                                <asp:ListItem Text="暂不上线" Value="0"></asp:ListItem>
                            </asp:RadioButtonList>
                        </td>
                    </tr>
                    <tr>
                        <td height="100" align="center">
                        </td>
                        <td height="100" colspan="7" align="left">
                            <input type="submit" id="Btn_Submit" runat="server" onclick="return Btn_Submit();"
                                onserverclick="Btn_Submit_Click" class="ui-btn-confirm" value="下一步" />&nbsp;
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
        <!--post-cont-->
    </div>
    <!--grid-m0-->
    <!--grid-m0-->
</asp:Content>
